/*
  Copyright (C) 2015 Luca Donaggio
  Contact: Luca Donaggio <donaggio@gmail.com>
  All rights reserved.

  You may use this file under the terms of MIT license as follows:

  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files (the "Software"), to deal
  in the Software without restriction, including without limitation the rights
  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  copies of the Software, and to permit persons to whom the Software is
  furnished to do so, subject to the following conditions:

  The above copyright notice and this permission notice shall be included in
  all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  THE SOFTWARE.
*/

import QtQuick 2.0
import Sailfish.Silica 1.0

Item {
    anchors { fill: parent; margins: Theme.paddingLarge; }

    property string centerOffsetX
    property string centerOffsetY
    property string zoom
    property bool useEmulDouble
    property bool panAndZoom

    Rectangle {
        id: navInfo

        anchors { top: parent.top; left: parent.left; }
        width: Theme.fontSizeTiny * 10
        height: navInfoContainer.height + (2 * Theme.paddingSmall)
        color: Qt.darker(Theme.primaryColor, 4.0)
        radius: (Theme.paddingSmall * 3 / 4)
        antialiasing: true

        Column {
            id: navInfoContainer
            anchors { top: parent.top; left: parent.left; right: parent.right; margins: Theme.paddingSmall; }
            spacing: Theme.paddingSmall

            Label {
                id: cOXLabel

                width: parent.width
                truncationMode: TruncationMode.Fade
                font.pixelSize: Theme.fontSizeTiny
                text: "X offset: " + centerOffsetX
            }

            Label {
                id: cOYLabel

                width: parent.width
                truncationMode: TruncationMode.Fade
                font.pixelSize: Theme.fontSizeTiny
                text: "Y offset: " + centerOffsetY
            }

            Label {
                id: zoomLabel

                width: parent.width
                truncationMode: TruncationMode.Fade
                font.pixelSize: Theme.fontSizeTiny
                text: "Zoom: " + zoom
            }
        }
    }

    Rectangle {
        id: dpInfo

        anchors { bottom: parent.bottom; left: parent.left; }
        width: dpInfoLabel.width + (2 * Theme.paddingSmall)
        height: dpInfoLabel.height + (2 * Theme.paddingSmall)
        color: Qt.darker(Theme.primaryColor, 4.0)
        radius: (Theme.paddingSmall * 3 / 4)
        antialiasing: true
        opacity: useEmulDouble ? 1.0 : 0.0

        Label {
            id: dpInfoLabel

            anchors.centerIn: parent
            font.pixelSize: Theme.fontSizeTiny
            text: "DP"
        }

        Behavior on opacity { FadeAnimation { } }
    }

    Rectangle {
        id: panInfo

        anchors { bottom: parent.bottom; left: dpInfo.right; leftMargin: Theme.paddingLarge; }
        width: panInfoLabel.width + (2 * Theme.paddingSmall)
        height: panInfoLabel.height + (2 * Theme.paddingSmall)
        color: Qt.darker(Theme.primaryColor, 4.0)
        radius: (Theme.paddingSmall * 3 / 4)
        antialiasing: true
        opacity: panAndZoom ? 1.0 : 0.0

        Label {
            id: panInfoLabel

            anchors.centerIn: parent
            font.pixelSize: Theme.fontSizeTiny
            text: qsTr("Pan / Zoom")
        }

        Behavior on opacity { FadeAnimation { } }
    }
}
